package com.ideawedo.tools;

import java.io.FileNotFoundException;
import java.io.IOException;

public class MHConfig {
	static PropertyManager pm = null;
	public static String FILENAME = "config/MyORM.properties";
	
	public static String driverClassName = null;
	public static String url = null;
	public static String uname = null;
	public static String password = null;
	public static int partition_count=2;
	public static int max_connections_per_partition=80;
	public static int min_connections_per_partition=5;
	public static int acquire_increment=5;
	public static int idle_connection_test_period_in_minutes=60;
	public static int idle_max_age_in_minutes=30;
	public static void load() throws FileNotFoundException, IOException {
		pm = new PropertyManager(FILENAME);
		driverClassName = pm.getString("driver_class_name");
		url = pm.getString("url");
		uname = pm.getString("uname");
		password = pm.getString("password");
		partition_count = pm.getInt("partition_count", 2);
		max_connections_per_partition = pm.getInt("max_connections_per_partition", 80);
		min_connections_per_partition = pm.getInt("min_connections_per_partition", 5);
		acquire_increment = pm.getInt("acquire_increment", 5);
		idle_connection_test_period_in_minutes = pm.getInt("idle_connection_test_period_in_minutes", 60);
		idle_max_age_in_minutes = pm.getInt("idle_max_age_in_minutes", 30);
	}
}
